

export default (Fn) => {
    const loadingBox = document.createElement('div');
    loadingBox.innerHTML = `loadding……`
    loadingBox.style.cssText +=`;
        position: fixed;
        left: 50%;
        right:50%;
        top: 50%;
        bottom: 50%;
        transform: translate(-50%, -50%);
        background: #0e0;
    `
    let isMount = false;

    Fn.prototype.$loading = {
        open: ()=> {
            loadingBox.style.display="block";
            if(!isMount){
                // diyici
                document.body.appendChild(loadingBox);
                isMount = true;
            }
            
        },
        close: () => {
            loadingBox.style.display = 'none';
        }
    }
}